{{!

  Copyright (c) Meta Platforms, Inc. and affiliates.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

}}
{{> AutoGenerated}}

package {{service:javaPackage}};
{{#service:disableReactive?}}// Generation of this class is disabled using (java.swift.disable_reactive){{/service:disableReactive?}}{{^service:disableReactive?}}
import java.util.*;

public class {{service:javaCapitalName}}ReactiveAsyncWrapper {{#service:extends}} extends {{service:javaPackage}}.{{service:javaCapitalName}}ReactiveAsyncWrapper{{/service:extends}}
  implements {{service:javaCapitalName}}.Async {
  private {{service:javaCapitalName}}.Reactive _delegate;

  public {{service:javaCapitalName}}ReactiveAsyncWrapper({{service:javaCapitalName}}.Reactive _delegate) {
    {{#service:extends}}super(_delegate);{{/service:extends}}
    this._delegate = _delegate;
  }

  public {{service:javaCapitalName}}ReactiveAsyncWrapper(org.apache.thrift.ProtocolId _protocolId, reactor.core.publisher.Mono<? extends com.facebook.thrift.client.RpcClient> _rpcClient, Map<String, String> _headers, Map<String, String> _persistentHeaders) {
    this(new {{service:javaCapitalName}}ReactiveClient(_protocolId, _rpcClient, _headers, _persistentHeaders));
  }

  @java.lang.Override
  public void close() {
    _delegate.dispose();
  }

  {{#service:singleRequestFunctions}}
  @java.lang.Override
  public com.google.common.util.concurrent.ListenableFuture<{{#function:return_type}}{{> BoxedType}}{{/function:return_type}}> {{function:javaName}}({{#function:args}}final {{#field:type}}{{> Type}}{{/field:type}} {{field:javaName}}{{^last?}}, {{/last?}}{{/function:args}}) {
      return com.facebook.thrift.util.FutureUtil.toListenableFuture(_delegate.{{function:javaName}}({{#function:args}}{{field:javaName}}{{^last?}}, {{/last?}}{{/function:args}}));
  }

  @java.lang.Override
  public com.google.common.util.concurrent.ListenableFuture<{{#function:return_type}}{{> BoxedType}}{{/function:return_type}}> {{function:javaName}}({{#function:args}}
    final {{#field:type}}{{> Type}}{{/field:type}} {{field:javaName}},{{/function:args}}
    com.facebook.thrift.client.RpcOptions rpcOptions) {
      return com.facebook.thrift.util.FutureUtil.toListenableFuture(_delegate.{{function:javaName}}({{#function:args}}{{field:javaName}},{{/function:args}} rpcOptions));
  }

  @java.lang.Override
  public com.google.common.util.concurrent.ListenableFuture<com.facebook.thrift.client.ResponseWrapper<{{#function:return_type}}{{> BoxedType}}{{/function:return_type}}>> {{function:javaName}}Wrapper({{#function:args}}
    final {{#field:type}}{{> Type}}{{/field:type}} {{field:javaName}},{{/function:args}}
    com.facebook.thrift.client.RpcOptions rpcOptions) {
    return com.facebook.thrift.util.FutureUtil.toListenableFuture(_delegate.{{function:javaName}}Wrapper({{#function:args}}{{field:javaName}},{{/function:args}} rpcOptions));
  }

  {{/service:singleRequestFunctions}}
  {{#service:interactions}}
  public class {{service:name}}Impl implements {{service:name}} {
    {{#service:singleRequestFunctions}}
    @java.lang.Override
    public com.google.common.util.concurrent.ListenableFuture<{{#function:return_type}}{{> BoxedType}}{{/function:return_type}}> {{function:javaName}}({{#function:args}}final {{#field:type}}{{> Type}}{{/field:type}} {{field:javaName}}{{^last?}}, {{/last?}}{{/function:args}}) {
        throw new UnsupportedOperationException("Interactions are not yet supported on ReactiveAsyncWrapper Interfaces!");
    }

    @java.lang.Override
    public com.google.common.util.concurrent.ListenableFuture<{{#function:return_type}}{{> BoxedType}}{{/function:return_type}}> {{function:javaName}}({{#function:args}}
      final {{#field:type}}{{> Type}}{{/field:type}} {{field:javaName}},{{/function:args}}
      com.facebook.thrift.client.RpcOptions rpcOptions) {
        throw new UnsupportedOperationException("Interactions are not yet supported on ReactiveAsyncWrapper Interfaces!");
    }

    @java.lang.Override
    public com.google.common.util.concurrent.ListenableFuture<com.facebook.thrift.client.ResponseWrapper<{{#function:return_type}}{{> BoxedType}}{{/function:return_type}}>> {{function:javaName}}Wrapper({{#function:args}}
      final {{#field:type}}{{> Type}}{{/field:type}} {{field:javaName}},{{/function:args}}
      com.facebook.thrift.client.RpcOptions rpcOptions) {
      throw new UnsupportedOperationException("Interactions are not yet supported on ReactiveAsyncWrapper Interfaces!");
    }

    {{/service:singleRequestFunctions}}
    @java.lang.Override
    public void close() {}
  }

  public {{service:name}} create{{service:name}}() {
      return new {{service:name}}Impl();
  }
  {{^last?}}

  {{/last?}}
  {{/service:interactions}}
}
{{/service:disableReactive?}}
